package org.harlov.testsys.db.suppdata;

import java.sql.Array;
import java.sql.SQLException;

public class ans_struct {
	private Boolean[] tans = null;
	private Boolean[] fans = null;
	private int test_log_id;
	private int ans_log_id;
	private int quest_id;
	
	public ans_struct (int fcou,int tcou
			) {
		tans = new Boolean[tcou];
		fans = new Boolean[fcou];
	}
	
	public ans_struct (int _ans_id,int _test_log_id,int _quest_id ,Array _fans,Array _tans) {
		try {
			if (_fans != null) 
				fans = (Boolean[]) _fans.getArray();
			if (_tans != null) 
				tans = (Boolean[]) _tans.getArray();
		} catch (SQLException e) {
			
			e.printStackTrace();
		}
		ans_log_id = _ans_id;
		test_log_id = _test_log_id;
		quest_id = _quest_id;
	}
	
	public void setValF(int pos,boolean val) {
		fans[pos] = val;
		
	}
	
	public void setValT(int pos,boolean val) {
		tans[pos] = val;
	}
	
	public Boolean[] getValsF() {
		return fans;
	}
	
	public Boolean[] getValsT() {
		return tans;
	}
	
	public boolean getValF(int pos) {
		if (fans[pos]!=null) 
			return fans[pos]; else
		return false;
	}
	
	public boolean getValT(int pos) {
		if (tans[pos]!=null)
		return tans[pos]; else
			return false;
	}
	
	public int getQuestId() {
		return quest_id;
	}
	
	public boolean isRight() {
		boolean result = true;
		if (tans!=null) {
		for (Boolean temp:tans)
			if (temp!=null) {
			if (temp.booleanValue() == false) result = false; }
				else result = false;
		} else result = false;
		if (fans!=null) {
		for (Boolean temp:fans) 
			if (temp!=null) {
			if (temp.booleanValue() == true) result = false; }
			
		} else result = false;
		return result;
	}
}
